<?php if ($playGame): ?>

<script>
	$("#loading").css("display", "none");
	intervalOff();
</script>

<div id="players">

	<table>
	<tr>
		<td>
		<div id="avatar">
		<?php 			
			$avatar = $this->Session->read('Auth.User.avatar');
			if (empty($avatar)){
				$avatar = 'user.png';
			}
			
			echo $this->Html->image("/files/uploads/avatares/". $avatar);			
		?>
		</div><!-- avatar -->
		</td>
	
		<td>
		<div id="avatar">
			<?php
				$avatar = $game['avatar_playing_with'];
				if (empty($avatar)){
					$avatar= 'user.png';
				}
				
				echo $this->Html->image("/files/uploads/avatares/". $avatar);
			?>
		</div><!-- avatar -->
		</td>
	</tr>
	<tr>
	</tr>
	<tr>
		<td>T&Uacute</td>
		<td><?php echo $game['playing_with']; ?></td>
	</tr>
	</table>
	
</div><!-- players -->

<div id="filmFrame">
<?php 
	echo $this->Html->image("/files/uploads/frames/".$game['frame_name']); 

    echo $this->Form->create('Game', array('default' => false));
    echo $this->Form->input('answer', array('label' => 'Pel&iacute;cua'));
    echo $this->Js->submit('Enviar respuesta', array(
    											'url' => array(
    												'controller' => 'games', 
    												'action' => 'answer'
    											),
    											'update' => '#game'
    										));
    $this->Form->end();
    
    echo $this->Js->writeBuffer(array('inline' => 'true'));
 ?>    
    
	<table>
	<tr>
		<td> 
		<?php 
			echo $this->Html->Link( 
				$this->Html->image("next.png"),
				array(
					'controller' => 'games', 
    				'action' => 'next'
    			),
    			array('escape' => false) 
    		);
		
			echo $this->Html->Link('Pasar de esta', array(
												'controller' => 'games', 
    											'action' => 'next'
    											));
    	?>
    	</td>
    	<td>
    	<?php
    		echo $this->Html->Link( 
				$this->Html->image("stop.png"),
				array(
					'controller' => 'games', 
    				'action' => 'stop'
    			),
    			array('escape' => false) 
    		); 
    	
			echo $this->Html->Link('STOP!!!', array(
												'controller' => 'games', 
    											'action' => 'stop'
    											));
		?>
		</td>
    </tr>
	</table>

</div><!-- filmFrame -->
<?php else: ?>
<script>
	$("#loading").css("display", "block");
</script>
<?php endif; ?>

